<?php
header('Content-type: text/xml');
include('../../config.php');
include(PUNG_ROOT . '/system/class/db.class.php');

$db = new DB(DB_HOST, DB_USER, DB_PASS, DB_NAME);

$sql = $db -> db_query("SELECT * FROM " . DB_PREFIX . "content ORDER BY id ASC");
$sql = $db -> db_result();

print '<rss version="2.0">' . "\n";
print '<channel>' . "\n";

print '	<title>' . PAGETITLE . ' - RSS</title>' . "\n";
print '	<description>' . SLOGAN . '</description>' . "\n";
print '	<link>' . PUNG_URL . '</link>' . "\n\n";

foreach($sql as $feed)
{
	print '<item>' . "\n";
	print '	<title>' . $feed['title'] . '</title>' . "\n";
	print '	<description>' . strip_tags($feed['content']) . '</description>' . "\n";
	print '	<link>' . PUNG_URL . '/modules/content/index.php?id=' . $feed['id'] . '</link>' . "\n";
	print '</item>' . "\n\n";
}

print '</channel>' . "\n";
print '</rss>' . "\n";
?>